package com.maidou.qiantai.service.impl;

import java.util.List;

import com.maidou.qiantai.vo.order.OsOrderItemInfoVo;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.maidou.qiantai.mapper.OsOrderItemMapper;
import com.maidou.qiantai.domain.OsOrderItem;
import com.maidou.qiantai.service.IOsOrderItemService;

import javax.annotation.Resource;

/**
 * 订单项信息Service业务层处理
 * 
 * @author maidou
 * @date 2024-03-15
 */
@Service
public class OsOrderItemServiceImpl implements IOsOrderItemService 
{
    @Resource
    private OsOrderItemMapper osOrderItemMapper;

    /**
     * 查询订单项信息
     * 
     * @param id 订单项信息主键
     * @return 订单项信息
     */
    @Override
    public OsOrderItem selectOsOrderItemById(Long id)
    {
        OsOrderItem osOrderItem = osOrderItemMapper.selectOsOrderItemById(id);

        return osOrderItem;
    }

    /**
     * 查询订单项信息列表
     * 
     * @param osOrderItem 订单项信息
     * @return 订单项信息
     */
    @Override
    public List<OsOrderItem> selectOsOrderItemList(OsOrderItem osOrderItem)
    {
        return osOrderItemMapper.selectOsOrderItemList(osOrderItem);
    }

    /**
     * 新增订单项信息
     * 
     * @param osOrderItem 订单项信息
     * @return 结果
     */
    @Override
    public int insertOsOrderItem(OsOrderItem osOrderItem)
    {
        osOrderItem.setCreateTime(DateUtils.getNowDate());
        return osOrderItemMapper.insertOsOrderItem(osOrderItem);
    }

    /**
     * 修改订单项信息
     * 
     * @param osOrderItem 订单项信息
     * @return 结果
     */
    @Override
    public int updateOsOrderItem(OsOrderItem osOrderItem)
    {
        osOrderItem.setUpdateTime(DateUtils.getNowDate());
        return osOrderItemMapper.updateOsOrderItem(osOrderItem);
    }

    /**
     * 批量删除订单项信息
     * 
     * @param ids 需要删除的订单项信息主键
     * @return 结果
     */
    @Override
    public int deleteOsOrderItemByIds(Long[] ids)
    {
        return osOrderItemMapper.deleteOsOrderItemByIds(ids);
    }

    /**
     * 删除订单项信息信息
     * 
     * @param id 订单项信息主键
     * @return 结果
     */
    @Override
    public int deleteOsOrderItemById(Long id)
    {
        return osOrderItemMapper.deleteOsOrderItemById(id);
    }

    /**
     * 获取订单项信息
     * @param id
     * @return
     */
    @Override
    public List<OsOrderItem> selectOsOrderItemByIds(Long id) {
        return osOrderItemMapper.selectOsOrderItemByIds(id);
    }

    @Override
    public Integer deleteOsOrderItemByOrderId(Long id) {
        return osOrderItemMapper.deleteOsOrderItemByOrderId(id);
    }

    @Override
    public List<Long> selectSpuIdByOrderId(Long id) {
        return osOrderItemMapper.selectSpuIdByOrderId(id);
    }
}
